home *** CD-ROM | disk | FTP | other *** search
/ ShareWare OnLine 2 / ShareWare OnLine Volume 2 (CMS Software)(1993).iso / prog / pbwiz17.zip / PLAYVOC.BAS < prev    next >
BASIC Source File  |  1993-06-20  |  3KB  |  77 lines

  1. '   +----------------------------------------------------------------------+
  2. '   |                                                                      |
  3. '   |        PBWiz  Copyright (c) 1991-1993  Thomas G. Hanlin III          |
  4. '   |                                                                      |
  5. '   +----------------------------------------------------------------------+
  6.  
  7. ' This is another simple demo of the PBWiz routines.  It allows you to play
  8. ' a digitized sound file (.VOC format) on a SoundBlaster.  The SBSIM driver,
  9. ' which is provided with the SoundBlaster, is required.
  10.  
  11. ' Syntax:
  12. '   PLAYVOC vocname[.VOC]
  13.  
  14. ' The file extension is optional.
  15.  
  16.    DECLARE SUB SBGetActive (INTEGER, INTEGER, INTEGER, INTEGER, INTEGER)
  17.    DECLARE FUNCTION SBInt% ()
  18.    DECLARE SUB SBInitSrcFile (INTEGER, STRING, INTEGER)
  19.    DECLARE SUB SBPlay (INTEGER)
  20.    DECLARE SUB SBStop (INTEGER)
  21.  
  22.    $LINK "pbwiz.pbl"
  23.  
  24.    DEFINT A-Z
  25.  
  26.  
  27.  
  28.    '--- Pluck filename from command line.
  29.    File$ = LTRIM$(RTRIM$(UCASE$(COMMAND$)))
  30.  
  31.    '--- If they didn't enter a filename, let's tell 'em about ourselves.
  32.    IF ((LEN(File$) = 0) OR (INSTR(File$, "/?") > 0)) THEN
  33.       PRINT "PLAYVOC: Digitized Sound Player for PBWiz by Thomas G. Hanlin III"
  34.       PRINT
  35.       PRINT "Syntax:"
  36.       PRINT "  PLAYVOC vocname[.VOC]
  37.       PRINT
  38.       PRINT "The file extension is optional and defaults to .VOC.  This demo plays .VOC"
  39.       PRINT "digitized sound files on a SoundBlaster, using the SBSIM driver."
  40.       END
  41.    END IF
  42.  
  43.    '--- Add .VOC extension if they didn't provide it.
  44.    IF (INSTR(File$, ".") = 0) THEN File$ = File$ + ".VOC"
  45.  
  46.    '--- Check the SBSIM interrupt to make sure SBSIM is installed.
  47.    IF (SBInt = 0) THEN
  48.       PRINT "PLAYVOC requires the SBSIM driver to function.  SBSIM is provided with the"
  49.       PRINT "SoundBlaster.  Go to your SoundBlaster directory and type SBSIM to install"
  50.       PRINT "the driver before using PLAYVOC.  You will probably get some extraneous error"
  51.       PRINT "messages from SBSIM-- ignore them.  PLAYVOC will tell you of any problem."
  52.       END
  53.    END IF
  54.  
  55.    '--- This is the number of the Disk Voice driver used for .VOC playing.
  56.    DriverNr = 2
  57.  
  58.    '--- Here we initialize Disk Voice handling for our .VOC file.
  59.    SBInitSrcFile DriverNr, File$, ErrCode
  60.    IF ErrCode THEN
  61.       PRINT "Error initializing "; File$; " for input.  Error code ="; ErrCode
  62.       END
  63.    END IF
  64.  
  65.    '--- This starts the .VOC file playing
  66.    SBPlay DriverNr
  67.  
  68.    '--- The file plays in the background, so we could do something here.
  69.    '--- In this case, though, we'll just wait for the file to finish.
  70.    '--- We'll exit if <ESC> is pressed, in case they want out.
  71.    DO
  72.       SBGetActive FM, DskVoice, MemVoice, Auxiliary, MIDI
  73.    LOOP UNTIL ((DskVoice = 0) OR (INKEY$ = CHR$(27)))
  74.  
  75.    '--- When we're done, we shut down the Disk Voice driver.
  76.    SBStop DriverNr
  77.